#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>


int main(int argc, char *argv[])
{
	struct gameState *state = newGame();
	int *bonus = malloc(sizeof(int));
	int i;
//test 1
	state->handCount[0] = 4;
	state->hand[0][0] = copper;
	state->hand[0][1] = silver;
	state->hand[0][2] = 0;
	state->hand[0][3] = mine;
        state->numPlayers = 1;
        state->whoseTurn = 0;
        state->numActions = 1;
        state->deckCount[0] = 10;
        state->discardCount[0] = 0;
        for(i = 0; i<10;i++){
                state->supplyCount[i] = i+7;
                state->deck[0][i] = i;
	}
	if(cardEffect(mine,0,silver,3,state,0,bonus) == -1){
		printf("Error with cardEffect\n");
	}
	if(state->hand[0][0] == silver && state->hand[0][1] == silver && state->hand[0][2] == 0){
		printf("mine PASSED on changing copper to silver\n");
	}
	else{
		printf("mine FAILED on changing copper to silver\n");
	}

//test 2
	state->handCount[0] = 4;
	state->hand[0][0] = copper;
	state->hand[0][1] = silver;
	state->hand[0][2] = 0;
	state->hand[0][3] = mine;
        state->numPlayers = 1;
        state->whoseTurn = 0;
        state->numActions = 1;
        state->deckCount[0] = 10;
        state->discardCount[0] = 0;
        for(i = 0; i<10;i++){
                state->supplyCount[i] = i+7;
                state->deck[0][i] = i;
	}
	printf("%d %d %d %d\n",state->hand[0][0],state->hand[0][1],state->hand[0][2], state->hand[0][3]);
	if(cardEffect(mine,0,gold,3,state,0,bonus) == -1){
		printf("Error with cardEffect\n");
	}
	if(state->hand[0][0] == copper && state->hand[0][1] == silver && state->hand[0][2] == 0){
		printf("mine PASSED by not changing copper to gold\n");
	}
	else{
		printf("mine FAILED by changing copper to gold\n");
	}
	printf("%d %d %d %d\n",state->hand[0][0],state->hand[0][1],state->hand[0][2], state->hand[0][3]);

//test 3
	state->handCount[0] = 4;
	state->hand[0][0] = copper;
	state->hand[0][1] = silver;
	state->hand[0][2] = 0;
	state->hand[0][3] = mine;
        state->numPlayers = 1;
        state->whoseTurn = 0;
        state->numActions = 1;
        state->deckCount[0] = 10;
        state->discardCount[0] = 0;
        for(i = 0; i<10;i++){
                state->supplyCount[i] = i+7;
                state->deck[0][i] = i;
	}
	printf("%d %d %d %d\n",state->hand[0][0],state->hand[0][1],state->hand[0][2],state->hand[0][3]);

	if(cardEffect(mine,1,gold,3,state,0,bonus) == -1){
		printf("Error with cardEffect\n");
	}
	if(state->hand[0][0] == copper && state->hand[0][1] == gold && state->hand[0][2] == 0){
		printf("mine PASSED on changing silver to gold\n");
	}
	else{
		printf("mine FAILED on changing silver to gold\n");
	}
	printf("%d %d %d %d\n",state->hand[0][0],state->hand[0][1],state->hand[0][2],state->hand[0][3]);

//test 4
	state->handCount[0] = 4;
	state->hand[0][0] = copper;
	state->hand[0][1] = silver;
	state->hand[0][2] = 0;
	state->hand[0][3] = mine;
        state->numPlayers = 1;
        state->whoseTurn = 0;
        state->numActions = 1;
        state->deckCount[0] = 10;
        state->discardCount[0] = 0;
        for(i = 0; i<10;i++){
                state->supplyCount[i] = i+7;
                state->deck[0][i] = i;
	}
	if(cardEffect(mine,2,silver,3,state,0,bonus) == -1){
		printf("Error with cardEffect\n");
	}
	if(state->hand[0][0] == copper && state->hand[0][1] == silver && state->hand[0][2] == 0){
		printf("mine PASSED by not changing curse to silver\n");
	}
	else{
		printf("mine FAILED by changing curse to silver\n");
	}
	return 0;
}

